#include<iostream>
#include<cstdio>
using namespace std;
int a[8010];
int n,q;
int main() {
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	cin>>n>>q;
	for(int i=1;i<=n;i++) {
		cin>>a[i];
	}
	for(int i=1;i<=q;i++) {
		int ort=0,c1=0,c2=0;
		cin>>ort;
		if(ort==1) {
			cin>>c1>>c2;
			a[c1]=c2;
		}
		if(ort==2) {
			cin>>c1;
			for(int i=1;i<=n;i++)
				if(a[i] < a[c1] || (a[i] == a[c1] && i < c1))
					c2++;
			cout << c2+1 << endl;
		}
	}
	return 0;
}
